<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>宿舍管理系统主页面</title>
		<link href="../bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
		<style type="text/css">
			html,
			body,
			.container-fluid {
				height: 100%;
				width: 100%;
			}
			
		</style>
	</head>
	<body>
		<div class="container-fluid">
		  <div id="top" class="row">
		   <nav class="navbar navbar-default" style="background-color: rgb(135, 172, 216);">
		     <div class="container-fluid">
		       <!-- Brand and toggle get grouped for better mobile display -->
		       <div class="navbar-header">
		         <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
		           <span class="sr-only">Toggle navigation</span>
		           <span class="icon-bar"></span>
		           <span class="icon-bar"></span>
		           <span class="icon-bar"></span>
		         </button>
		         <p class="navbar-brand" href="#">宿舍管理系统</p>
		       </div>
		   
		       <!-- Collect the nav links, forms, and other content for toggling -->
		       <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
		         <ul class="nav navbar-nav navbar-right">
		           <li><a href="#">当前登录的用户:</a></li>
		           <li class="dropdown">
		             <a id="Dropdown" href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"> <span  class="caret"></span></a>
		             <ul class="dropdown-menu">
		               <li><a id="a_mm" href="#">修改密码</a></li>
		               <li role="separator" class="divider"></li>
		               <li><a href="login.html">注销用户</a></li>
		             </ul>
		           </li>
		         </ul>
		       </div><!-- /.navbar-collapse -->
		     </div><!-- /.container-fluid -->
		   </nav>
		  </div>
		  <div class="row">
		   <div class="col-md-2">
			   <div class="list-group">
			     <a href="#" id="yi" class="list-group-item active">
			      首页
			     </a>
			     <a id="a_ss"  href="#" class="list-group-item hidden" >宿舍管理员管理</a>
			     <a id="a_xues"  href="#" class="list-group-item hidden">学生管理</a>
			     <a id="a_ssl"  href="#" class="list-group-item hidden">宿舍楼管理</a>
				  <a id="a_xuesck"  href="#" class="list-group-item hidden">学生查看</a>
			     <a id="absence"  href="#" class="list-group-item">缺勤记录</a>
				  <a id="xiugai"  href="#" class="list-group-item">修改密码</a>
				   <a id="login_out"  href="#" class="list-group-item">退出系统</a>
			   </div>
			   
		   </div>
		   <div class="col-md-10" style="text-align: center; color: rgb(128, 128, 128);">
				  <!-- <button id="nihao" type="button">钱钱钱dian</button> -->
			   <div class="embed-responsive embed-responsive-16by9">
				   <h2 id="xitgliy" hidden>欢迎您，系统管理员</h2>
				   <h2 id="ssgly" hidden>欢迎您，宿舍管理员</h2>
				   <h2 id="hiya" hidden>欢迎您，同学</h2>
			    <iframe id="ifra" class="embed-responsive-item" src=""></iframe> 
			   </div>
		   </div>
		  </div>
		</div>
		<script src="../js/jquery-3.5.1.js"></script>
		<script src="../bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
		<script type="text/javascript">
			$(function(){
			let current_user = JSON.parse(sessionStorage.getItem("current_user"));
			console.log(current_user);
			console.log(current_user.cu_user);
			
			$("#Dropdown").append(current_user.cu_user);
			// if (!current_user) {
			// 	alert("请先登录");
			// 	location.href="login.html";
			// 	return;
			// }
			let user_type=current_user.yhlx;
			//判断登录类型，分类操作
			if (user_type==="student") {
				$("#hiya").show();
				//缺勤记录
				$("#absence").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item hidden"});
					$("#a_xues").prop({class:"list-group-item hidden "});
					$("#a_ssl").prop({class:"list-group-item  hidden"});
					$("#absence").prop({class:"list-group-item active"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"queqin.html"});
					$("#xitgliy").remove();
				})
				//修改密码
				$("#xiugai").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item hidden"});
					$("#a_xues").prop({class:"list-group-item hidden"});
					$("#a_ssl").prop({class:"list-group-item hidden"});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item active"});
					$("#ifra").attr({src:"xiugai.html"});
					$("#xitgliy").remove();
				})
				
			} else if (user_type==="administrators") {
				$("#ssgly").show();
				$("#a_xuesck").prop({class:"list-group-item"});
				//学生查看
				$("#a_xuesck").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item hidden"});
					$("#a_xues").prop({class:"list-group-item hidden "});
					$("#a_ssl").prop({class:"list-group-item  hidden"});
					$("#a_xuesck").prop({class:"list-group-item active"});
					$("#absence").prop({class:"list-group-item "});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"yem_student.html"});
					$("#ssgly").remove();
				})
				//缺勤记录
				$("#absence").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item hidden"});
					$("#a_xues").prop({class:"list-group-item hidden "});
					$("#a_ssl").prop({class:"list-group-item  hidden"});
					$("#a_xuesck").prop({class:"list-group-item "});
					$("#absence").prop({class:"list-group-item active"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"queqin.html"});
					$("#xitgliy").remove();
				})
				//修改密码
				$("#xiugai").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item hidden"});
					$("#a_xues").prop({class:"list-group-item hidden"});
					$("#a_ssl").prop({class:"list-group-item hidden"});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item active"});
					$("#ifra").attr({src:"xiugai.html"});
					$("#xitgliy").remove();
				})
			} else{
				$("#xitgliy").show();
				$("#a_ss").prop({class:"list-group-item"});
				$("#a_xues").prop({class:"list-group-item"});
				$("#a_ssl").prop({class:"list-group-item"});
				//$("div>a:not(:checked)").prop({class:"list-group-item"});
				//按钮路径的改变
				//宿舍管理员管理
				$("#a_ss").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item active"});
					$("#a_xues").prop({class:"list-group-item"});
					$("#a_ssl").prop({class:"list-group-item"});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"yem_administrators.html"});
					$("#xitgliy").remove();
				})
				
				//学生管理
				$("#a_xues").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item "});
					$("#a_xues").prop({class:"list-group-item active"});
					$("#a_ssl").prop({class:"list-group-item"});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"yem_student.html"});
					$("#xitgliy").remove();
				})
				//宿舍楼管理
				$("#a_ssl").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item "});
					$("#a_xues").prop({class:"list-group-item "});
					$("#a_ssl").prop({class:"list-group-item active"});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"yem_floor.html"});
					$("#xitgliy").remove();
				})
				//缺勤记录
				$("#absence").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item "});
					$("#a_xues").prop({class:"list-group-item "});
					$("#a_ssl").prop({class:"list-group-item "});
					$("#absence").prop({class:"list-group-item active"});
					$("#xiugai").prop({class:"list-group-item"});
					$("#ifra").attr({src:"queqin.html"});
					$("#xitgliy").remove();
				})
				//修改密码
				$("#xiugai").click(function(){
					$("#yi").prop({class:"list-group-item"});
					$("#a_ss").prop({class:"list-group-item "});
					$("#a_xues").prop({class:"list-group-item "});
					$("#a_ssl").prop({class:"list-group-item "});
					$("#absence").prop({class:"list-group-item"});
					$("#xiugai").prop({class:"list-group-item active"});
					$("#ifra").attr({src:"xiugai.html"});
					$("#xitgliy").remove();
				})
			}
			//退出系统
			$("#login_out").click(function(){
				sessionStorage.removeItem(current_user);
				location.href="login.html";
			})
			//右上角的修改密码
			$("#a_mm").click(function(){
				$("#ifra").attr({src:"xiugai.html"});
			})
				// $("#nihao").click(function(){
				// 	console.log(111)
				// 	// $("#hiya").show();
				// 	$("#hiya").prop({class:"list-group-item"});
				// 	$("#ifra").attr({src:"yem_floor.html"});
				// })
			})
		</script>
	</body>
</html>
